package cn.dada.dadarecipes.mall.product.service.impl;

import cn.dada.dadarecipes.mall.product.mapper.ProductMapper;
import cn.dada.dadarecipes.mall.product.pojo.dto.ProductQuery;
import cn.dada.dadarecipes.mall.product.pojo.vo.ProductVO;
import cn.dada.dadarecipes.mall.product.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    ProductMapper productMapper;
    @Override
    public List<ProductVO> selectProductList(ProductQuery productQuery) {
        log.debug("商城商品列表查询业务：productQuery={}",productQuery);
        List<ProductVO> list = productMapper.selectProduct(productQuery);
        return list;
    }

    @Override
    public ProductVO selectProduct(Long productId) {
        log.debug("商城商品列表查询：productId={}",productId);
        ProductQuery productQuery = new ProductQuery();
        productQuery.setId(productId);
        return productMapper.selectProduct(productQuery).get(0);
    }
}
